package org.xm.sk.vo.tb;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.xm.sk.vo.Base;
import org.xm.sk.vo.e.WorksStatus;
import org.xm.sk.vo.e.WorksType;

import com.fasterxml.jackson.annotation.JsonIgnore;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

@Entity
@Getter
@Setter
@Table(name = "dc_works")
@ApiModel(value = "Works", parent = Base.class, description = "作品")
public class Works extends Base {

    /**
     * 
     */
    private static final long serialVersionUID = 8292015941289486634L;

    @ApiModelProperty(value = "作品名称")
    @Column(length = 255)
    private String name;
    
    @ApiModelProperty(value = "作品描述")
    @Column(length = 1000)
    private String content;
    
    @ApiModelProperty(value = "作品类别")
    @Enumerated(value = EnumType.ORDINAL)
    @Column
    private WorksType wtype;

    @ApiModelProperty(value = "作品所属发型师")
    @JsonIgnore
    @ManyToOne(cascade = { CascadeType.MERGE }, fetch = FetchType.LAZY)
    @JoinColumn(name = "dc_hairdresser_id")
    private Hairdresser hairdresser;
 
    @ApiModelProperty(value = "作品图片")
    @JsonIgnore
    @ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY)
    @JoinColumn(name = "dc_image_id")
    private Image image;
    
    @ApiModelProperty(value = "作品状态")
    @Enumerated(value = EnumType.ORDINAL)
    @Column
    private WorksStatus status;
    
    @ApiModelProperty(value = "是否置顶显示")
    @Column(columnDefinition="tinyint(1) default 0")
    private Boolean putop;

}
